//
//  MBSongDetailForIController.m
//  MiBaoTu
//
//  Created by mac004 on 2016/10/12.
//  Copyright © 2016年 com.caesartech15. All rights reserved.
//

#import "MBSongDetailForIController.h"
#import "DXSemiViewControllerCategory.h"
#import "MBButtonView.h"
#import "MBBottomView.h"
#import "MBCommentController.h"
#import "ConmentCell.h"
#import "MBSpaceNewsDetailViewController.h"
#define TABLE_ROW_HEIGHT (35)

#import "MBLoginController.h"
@interface MBSongDetailForIController ()<UITableViewDataSource,UITableViewDelegate,MBButtonViewDelegate,MBBottomViewDelegate>
{
    NSTimer                 *_showTimer;
    BOOL                    isFromBackGround;  //是否从后台切入
    //CLShareManager *shareView;
    UIImageView             *_BGImgView;//背景图
    UIImageView             *_bigSongImg;//歌曲大图
     UIImageView             *_smallSongImg;//歌曲小图
    MBButtonView               *buttonView;
     UILabel                  *_contentLb;//故事内容
    NSString                  * _contenetStr;//
    
     PLayerModelType         playModelType;      //播放模式
    UIImageView               *_anchorImg;//主播头像
     MBBottomView   *_bottomForSonView;//亲子秀播放评论底部View
    CLShareManager *shareView;
    UIView                  *blurryView;//视图模糊层
    NSMutableArray          *fileIDArr;
    NSMutableArray          *collectionMusicArr;
    UIButton     *  focusBtn;//关注按钮
    BOOL           isFocus;//是否关注
    NSNumber      *FansNum;//粉丝数
    NSInteger      CollectNum;
    NSUInteger     ShareNum;
   
    NSInteger      ListenNum;
     int                         nextPlay;
        UIView                  *noLrcView;     //无歌词显示view
  NSMutableArray                      *_praiseListArr;   //点赞数量
    
    UIButton*zanBtn;
    NSMutableDictionary* statusDic;//状态字典
    UIScrollView*storyView;//主播感想scrollView
    NSArray                             *downedMusicArr;//已下载的歌曲

    
}

@property (strong, nonatomic)  UISlider *sliderBtn;
@property(strong,nonatomic) UIImageView * headerImg;//主播头像
@property( strong, nonatomic)UILabel*name;//主播名
@property( strong,nonatomic) UILabel * timeOnshow;//主播时间
@property(strong,nonatomic) UILabel * instrcutionLab;//主播标签
@property(strong,nonatomic) UILabel * numberOfFan;//粉丝数
@property(strong,nonatomic) UILabel * numOfZan;//点赞数
@property(strong,nonatomic) UITableView* tableView;
@property(strong,nonatomic) UILabel * numberOfListen;//已收听人数

@property(nonatomic,strong)NSMutableArray*commentDateArr;//评论数组
@end

@implementation MBSongDetailForIController
@synthesize  progressSlider, playBtn, circleBtn, currentTimeLabel, totalTimeLabel, lrcTableView, musicArray,singer,songName,nextBtn,aboveBtn;


-(NSMutableArray*)commentDateArr{
    if (!_commentDateArr) {
        _commentDateArr=[NSMutableArray new];
    }return _commentDateArr;
}
-(void)onUpdateUIForView:(UIDeviceOrientation)orientation{
    
}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSNumber *orientationUnknown = [NSNumber numberWithInt:UIInterfaceOrientationUnknown];
    [[UIDevice currentDevice] setValue:orientationUnknown forKey:@"orientation"];
    
    NSNumber *orientationTarget = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
    [[UIDevice currentDevice] setValue:orientationTarget forKey:@"orientation"];
  
    
    songName.text = [musicArray[musicArrayNumber] name];
    singer.text = [musicArray[musicArrayNumber] name];
}
- (BOOL)shouldAutorotate{
    //是否允许转屏
    return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    //viewController所支持的全部旋转方向
    return  UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    //viewController初始显示的方向
    return UIInterfaceOrientationLandscapeLeft;
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
     [self.navigationController setNavigationBarHidden:NO animated:NO];
    
    //离开判断播放器是否正在播放
    if (_showTimer && [_showTimer isValid]) {
        [[UserManager standerDefult] setMainPlayer:audioPlayer];
        [[UserManager standerDefult]setIsBackPlay:playBtn.selected];
        
        [_showTimer invalidate];
        _showTimer = nil;
    } else {
        [[UserManager standerDefult] setMainPlayer:audioPlayer];
        [[UserManager standerDefult] setIsBackPlay:NO];
    }
    

    
    if (self.type==IdentityType_online|self.type==IdentityType_listen) {
        //表的显示区域最多显示的歌词行数
        int count = lrcTableView.height / TABLE_ROW_HEIGHT;
        count = count / 2;
        if (lrcLineNumber > count) {
            //显示在这行时，开始往上移动一个单元格高度
            [[UserManager standerDefult]setMainPoint:CGPointMake(0, TABLE_ROW_HEIGHT*(lrcLineNumber-count))];
        } else {
            [[UserManager standerDefult]setMainPoint:CGPointMake(0, 0)];
        }
        
        [[UserManager standerDefult]setSelectMusicIndex:musicArrayNumber];
        [[UserManager standerDefult]setMusicArr:musicArray];
        [[UserManager standerDefult]setIsPlaying:!isPlay];
        [[UserManager standerDefult]setIsOnlinePlayer:_isFromOnLine];
        
        [[NSUserDefaults standardUserDefaults]setObject:(_isFromOnLine?@1:@0) forKey:@"isOnlineForMusic"];
     

    }
    else if (self.type==IdentityType_son){
        
        [[UserManager standerDefult]setSelectMusicIndex:musicArrayNumber];
        [[UserManager standerDefult]setMusicArr:musicArray];
        [[UserManager standerDefult]setQinzixiuArr:_dataAllArr];
        [[UserManager standerDefult]setAudioPlayerType:AudioPLayerType_Qinzix];
        [[UserManager standerDefult]setIsPlaying:isPlay];
         [[UserManager standerDefult]setIsLastID:[NSString stringWithFormat:@"%@",currentMusic.ID]];
        [[UserManager standerDefult]setIsPlaying:playBtn.selected];
        [[UserManager standerDefult]setIsBackPlay:(playBtn.selected == YES?YES:NO)];

        [[NSNotificationCenter defaultCenter] removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:nil];
        [[NSNotificationCenter defaultCenter] removeObserver:self name:AVPlayerItemFailedToPlayToEndTimeNotification object:nil];
        

    }else if (self.type==IdentityType_hot){
        [[UserManager standerDefult]setSelectMusicIndex:musicArrayNumber];
        [[UserManager standerDefult]setMusicArr:musicArray];
        [[UserManager standerDefult]setIsPlaying:isPlay];
        [[UserManager standerDefult]setAudioPlayerType:AudioPLayerType_ZhuBo];
        [[UserManager standerDefult]setZhuboDic:_dateDic];
    }
       [[NSUserDefaults standardUserDefaults]synchronize];
    
}


#pragma MARK---获取音频收藏状态
-(void)getAudioStatus{
    NSNumber*UserID=[UserManager standerDefult].userModel.UserID;
    NSNumber*CollectType=@1;
    NSNumber*ShowID=[NSNumber numberWithInteger:[currentMusic.ID integerValue]];
    NSString*url=[NSString stringWithFormat:AUDIO_STATUSJUDGE_URL_PATH,UserID,ShowID,CollectType];
    [[HTTPManager standerDefault]AFGetRequest:url view:nil success:^(id json) {
        NSLog(@"json==%@",json);
    } failure:^(NSError *error) {
        
    }];
    
}
#pragma mark---亲子秀数据
-(void)initDateForSon{
    //获取音频列表的歌曲数据
    NSMutableArray *musicArr = [UserManager standerDefult].musicArr;
    if (musicArr.count > 0) {
        musicArray = [[NSMutableArray alloc]initWithArray:musicArr];
    }
    //
    musicArrayNumber = [UserManager standerDefult].selectMusicIndex;
    
    //获取当前的歌曲信息
    if (musicArray.count > musicArrayNumber) {
        currentMusic = musicArray[musicArrayNumber];
    }
    
    //亲子秀歌曲列表保存
    [NSKeyedArchiver archiveRootObject:musicArray toFile:[MusicCachesDirectory stringByAppendingPathComponent:@"collectionMusic.data"]];
    [NSKeyedArchiver archiveRootObject:_dataAllArr toFile:[MusicCachesDirectory stringByAppendingPathComponent:@"last_qinzixiu.data"]];
}

-(void)reloadUIForSon{
    if (![_dateDic[@"CoverPath"] isKindOfClass:[NSNull class]]) {
        [_bigSongImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,_dateDic[@"CoverPath"]]] placeholderImage:[UIImage imageNamed:@"bg_qzxbf"]];
    }else{
        _bigSongImg.image =[UIImage imageNamed:@"bg_qzxbf"];
    }
    songName.text=_dateDic[@"ShowTitle"];
    if (![_dateDic[@"CoverPath"] isKindOfClass:[NSNull class]]) {
        [_smallSongImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,_dateDic[@"CoverPath"]]] placeholderImage:[UIImage imageNamed:@"bg_qzxbf"]];
    }else{
        _smallSongImg.image =[UIImage imageNamed:@"bg_qzxbf"];
    }
}
#pragma mark---获取亲子秀状态信息
-(void)getStatus{
    
    NSNumber*UserID=[UserManager standerDefult].userModel.UserID;
    NSNumber*ShowID=_dateDic[@"ID"];
    NSNumber*IssueUserID=_dateDic[@"UserID"];
    
    NSString*url=[NSString stringWithFormat:FAMILYSHOW_STATUS_URL_PATH,UserID,ShowID,IssueUserID];
  
     [[HTTPManager standerDefault]AFGetRequest:url view:nil success:^(id json) {
        
    
        if ([json[@"ret_code"] integerValue]==0) {
           
            if ([json isKindOfClass:[NSDictionary class]]) {
                _bottomForSonView.dataDic=json;
                [statusDic addEntriesFromDictionary:json];
             //   _bottomForSonView.praiseBtn setTitle:<#(nullable NSString *)#> forState:<#(UIControlState)#>
                
                NSString * CollectStatus= [NSString stringWithFormat:@"%@",json[@"CollectStatus"]];
                
                if ([CollectStatus isEqualToString:@"1"]) {
                    [buttonView onUpdateCollection:YES];
                }else{
                     [buttonView onUpdateCollection:NO];
                }
                
                
            }
       
            
            
        }
        
    } failure:^(NSError *error) {
        
    }];
}



#pragma mark---获取评论信息


-(void)getCommentMsg{


    
    [_dateDic removeAllObjects];
    NSInteger selectIndex = [[UserManager standerDefult]selectMusicIndex];
    if (selectIndex < _dataAllArr.count) {
        NSDictionary*dict=[_dataAllArr objectAtIndex:selectIndex];
        [_dateDic addEntriesFromDictionary:dict];
       
    }
    

  
 
    
    [self getStatus];
    [self reloadUIForSon];
    
    
    //已下载亲子秀记录
    downedMusicArr = [[FMManageObject standerDefault]onSelectLocalParentChildShowCount];
    fileIDArr = [[NSMutableArray alloc]initWithCapacity:downedMusicArr.count];
    for (int i=0; i<downedMusicArr.count; i++) {
        NSDictionary *dic = [downedMusicArr objectAtIndex:i];
        NSString *fileID = [dic objectForKey:@"musicId"];
        [fileIDArr addObject:fileID];
    }
    NSString *currentId = [NSString stringWithFormat:@"%@",currentMusic.ID];
    BOOL isDowned = NO;
    for (NSDictionary *dic in downedMusicArr) {
        NSString *idString = [dic objectForKey:@"musicId"];
        if ([idString isEqualToString:currentId]) {
            isDowned = YES;
        }
    }
    [buttonView onUpdateDown:isDowned withModel:currentMusic];
    
    [_bottomForSonView.shareBtn setTitle:[NSString stringWithFormat:@"分享(%@)",_dateDic[@"ShareNum"]]forState:0];
    
    
    UserModel *model = [UserManager standerDefult].userModel;
    if (!model.UserID) {
        MBLoginController *registerLastVC = [[MBLoginController alloc] init];
        registerLastVC.formBaseViewCtrl = NSStringFromClass([self class]);
        [self.navigationController pushViewController:registerLastVC animated:YES];
        return;
    }
    
    NSNumber *UserID=  [UserManager standerDefult].userModel.UserID;
    NSNumber *ID=_dateDic[@"ID"];
     NSNumber *IssueUserID=_dateDic[@"UserID"];
  
    [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:FAMILYSHOW_SHOW_INFO_URL_PATH,ID,IssueUserID,UserID,@1] view:nil success:^(id json) {
    
        if ([json[@"ret_code"] integerValue]==0) {
          
            
            NSNumber*commentNum=json[@"CommentNum"];
            FansNum=json[@"FansNum"];
            NSArray*arr=json[@"data"];
          
            
            [_bottomForSonView.commentBtn setTitle:[NSString stringWithFormat:@"评论 (%@)",commentNum] forState:0];
            NSNumber*Status=json[@"Status"];
            if ([Status isEqual:@(1)]) {
              
                isFocus = YES;
                
            }
            else{
                isFocus = NO;
              
            }
         //   _bottomForSonView.dataDic=_dateDic;
            if (arr.count > 0) {
               [_commentDateArr removeAllObjects];
                for (NSDictionary*dic in arr) {
                    [_commentDateArr addObject:dic];
                    
                }
                
            }
            

            if (_commentDateArr.count>3) {
                _tableView.height=_tableView.height;
            }else{
                _tableView.height=_bigSongImg.height-(3-_commentDateArr.count)*166*PERCEN;
            }
            _bottomForSonView.frame=CGRectMake(_tableView.left, _tableView.bottom, _tableView.width, 120*PERCEN);

            [_tableView  reloadData];
        } else {
             _tableView.height=_bigSongImg.height-3*166*PERCEN;
            _bottomForSonView.frame=CGRectMake(_tableView.left, _tableView.bottom, _tableView.width, 120*PERCEN);
             [_tableView  reloadData];
            [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
        }
    } failure:^(NSError *error) {

        [MBProgressHUD hideHUDForView:self.view animated:YES];
       
    }];
   // [self onLoadPraiseDB];
    
}

//UI布局
-(void)creatUI{

  //背景
    _BGImgView=[[UIImageView alloc]initWithFrame:self.view.bounds];
    _BGImgView.image=[UIImage imageNamed:@"bg_qzxbf"];
    [self.view addSubview:_BGImgView];
    
    //模糊层
    blurryView=[[UIView alloc]initWithFrame:self.view.bounds];
    blurryView.backgroundColor=[UIColorFromHex(0x000000) colorWithAlphaComponent:0.65];
    [self.view addSubview:blurryView];
    
    [self.view insertSubview:blurryView aboveSubview:_BGImgView];
    //歌曲大图
    _bigSongImg=[[UIImageView alloc]initWithFrame:CGRectMake(150*PERCEN, 250*PERCEN, SCREEN_WIDTH/2048*800, SCREEN_WIDTH/2048*800)];
    _bigSongImg.image=[UIImage imageNamed:@"bg_qzxbf"];
    [blurryView addSubview:_bigSongImg];
    
    //上一首
    aboveBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    aboveBtn.frame=CGRectMake(80*PERCEN, _bigSongImg.bottom+326*PERCEN, 80*PERCEN, 80*PERCEN);
    [aboveBtn setImage:[UIImage imageNamed:@"shangyiqu_dt"] forState:0];
    [aboveBtn addTarget:self action:@selector(aboveMusic:) forControlEvents:UIControlEventTouchUpInside];
    [blurryView addSubview:aboveBtn];
    //播放按钮
    playBtn=[UIButton buttonWithType:UIButtonTypeCustom];
   playBtn.frame=CGRectMake(aboveBtn.right+50*PERCEN, _bigSongImg.bottom+316*PERCEN, 100*PERCEN, 100*PERCEN);
    [playBtn setImage:[UIImage imageNamed:@"bofang_dt"] forState:0];
    [playBtn addTarget:self action:@selector(play:) forControlEvents:UIControlEventTouchUpInside];
    [blurryView addSubview:playBtn];
    //下一曲
    nextBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  nextBtn.frame=CGRectMake(playBtn.right+50*PERCEN, _bigSongImg.bottom+326*PERCEN, 80*PERCEN, 80*PERCEN);
    [nextBtn setImage:[UIImage imageNamed:@"xiayiqu_dt"] forState:0];
    [nextBtn addTarget:self action:@selector(nextMusic:) forControlEvents:UIControlEventTouchUpInside];
    [blurryView addSubview:nextBtn];
    //小图
    _smallSongImg=[[UIImageView alloc]initWithFrame:CGRectMake(self.nextBtn.right+80*PERCEN, _bigSongImg.bottom+304*PERCEN, 120*PERCEN, 120*PERCEN)];
    _smallSongImg.image=[UIImage imageNamed:@"bg_qzxbf"];
    [blurryView addSubview:_smallSongImg];
    //歌曲名
    songName=[[UILabel alloc]initWithFrame:CGRectMake(_smallSongImg.right+30*PERCEN, nextBtn.top, 320*PERCEN, 30*PERCEN)];
   songName.font=[UIFont systemFontOfSize:30*PERCEN];
    songName.textColor=UIColorFromHex(0xffffff);
   songName.text=@"捉泥鳅";
    [blurryView addSubview:songName];
    
    //进度条
    progressSlider=[[UISlider alloc]initWithFrame:CGRectMake(songName.left, songName.bottom+30*PERCEN, 756*PERCEN, 4*PERCEN)];
  progressSlider.minimumValue=0;
    progressSlider.maximumValue=1;
  progressSlider.value=0;
    progressSlider.maximumTrackTintColor=UIColorFromHex(0xeb6fa7);
    [progressSlider addTarget:self action:@selector(progressChange:) forControlEvents:UIControlEventValueChanged];
    [blurryView addSubview:progressSlider];
   //当前播放时间
    currentTimeLabel=[[UILabel alloc]initWithFrame:CGRectMake(_smallSongImg.right+600*PERCEN, songName.top+2*PERCEN, 100*PERCEN, 26*PERCEN)];
    currentTimeLabel.font=[UIFont systemFontOfSize:26*PERCEN];
   currentTimeLabel.textColor=UIColorFromHex(0xffffff);
    currentTimeLabel.text=@"00:00 ";
    [blurryView addSubview:currentTimeLabel];
    
    //分割线
    UILabel * label=[[UILabel alloc]initWithFrame:CGRectMake(currentTimeLabel.right, currentTimeLabel.top, 10*PERCEN, 26*PERCEN)];
    label.font=[UIFont systemFontOfSize:26*PERCEN];
    label.textColor=UIColorFromHex(0xffffff);
    label.text=@"/";
    [blurryView addSubview:label];
    //歌曲总时间
   totalTimeLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.currentTimeLabel.right+20*PERCEN, songName.top+2*PERCEN, 80*PERCEN, 26*PERCEN)];
   totalTimeLabel.font=[UIFont systemFontOfSize:26*PERCEN];
   totalTimeLabel.textColor=UIColorFromHex(0xffffff);
    totalTimeLabel.text=@"00:00";
    [blurryView addSubview:self.totalTimeLabel];
    
    
    //分享区域
    buttonView =[[MBButtonView alloc]initWithFrame:CGRectMake(progressSlider.right+40*PERCEN, _bigSongImg.bottom+330*PERCEN, 600*PERCEN, 100*PERCEN)];
    buttonView.delegate=self;
    [blurryView addSubview:buttonView];
    
    if (self.type == IdentityType_hot) {
#pragma mark ---人气主播
        //人气主播
        //头部
        UIView*topView=[[UIView alloc]initWithFrame:CGRectMake(_bigSongImg.right+120*PERCEN, 250*PERCEN, 858*PERCEN, 190*PERCEN)];
        topView.backgroundColor=[UIColorFromHex(0xffffff) colorWithAlphaComponent:0.3];
        [blurryView addSubview:topView];
        self.headerImg=[[UIImageView alloc]initWithFrame:CGRectMake(30*PERCEN, 30*PERCEN, 140*PERCEN, 140*PERCEN)];
        self.headerImg.image=[UIImage imageNamed:@"baba_zl"];
        [topView addSubview:self.headerImg];
        //姓名
        self.name=[[UILabel alloc]initWithFrame:CGRectMake(self.headerImg.right+30*PERCEN, 40*PERCEN, 240*PERCEN, 40*PERCEN)];
        self.name.font = [UIFont systemFontOfSize:30*PERCEN];
        self.name.textColor=UIColorFromHex(0xffffff);
        self.name.text=@"Emily的爸爸";
        [topView addSubview:self.name];
        //时钟图标
        UIImage*timeImg=[UIImage imageNamed:@"shijian_qzxbf"];
        UIImageView*timeImgView=[[UIImageView alloc]initWithFrame:CGRectMake(self.name.right+40*PERCEN, self.name.bottom-timeImg.size.height, timeImg.size.width, timeImg.size.height)];
        timeImgView.image=timeImg;
        [topView addSubview:timeImgView];
        //播出时间
        self.timeOnshow=[[UILabel alloc]initWithFrame:CGRectMake(timeImgView.right+10*PERCEN, timeImgView.top, 160*PERCEN, 26*PERCEN)];
        self.timeOnshow.font=[UIFont systemFontOfSize:26*PERCEN];
        self.timeOnshow.textColor=UIColorFromHex(0xffffff);
        self.timeOnshow.text=@"8-17  22:27";
        [topView addSubview:self.timeOnshow];
        //主播简介
        self.instrcutionLab=[[UILabel alloc]initWithFrame:CGRectMake(self.headerImg.right+30*PERCEN, self.timeOnshow.bottom+30*PERCEN, 628*PERCEN, 80*PERCEN)];
        self.instrcutionLab.numberOfLines=0;
        self.instrcutionLab.font=[UIFont systemFontOfSize:26*PERCEN];
        self.instrcutionLab.textColor=UIColorFromHex(0xffffff);
        self.instrcutionLab.text=@"猫猫主播,90后新一代主播,声音甜美,精通各种童话故事,声情并茂,深受各年龄段宝宝的喜爱";
        [topView addSubview:self.instrcutionLab];
        
        //底部故事及点赞
        UIView * bottomView = [[UIView alloc]initWithFrame:CGRectMake(topView.left, topView.bottom, topView.width, 610*PERCEN)];
        bottomView.backgroundColor=[UIColorFromHex(0xffffff) colorWithAlphaComponent:.2];
        [blurryView addSubview:bottomView];
    //点赞区域
    // 点赞数
        self.numOfZan =[[UILabel alloc]initWithFrame:CGRectMake(bottomView.width-200*PERCEN, bottomView.height-50*PERCEN, 150*PERCEN, 28*PERCEN)];
        self.numOfZan.font=[UIFont systemFontOfSize:28*PERCEN];
        self.numOfZan.textColor=UIColorFromHex(0xffffff);
        self.numOfZan.text=@"点赞 (999)";
        [bottomView addSubview:self.numOfZan];
        //点赞图标
        UIImage*zanImg=[UIImage imageNamed:@"zan1"];
        zanBtn=[UIButton buttonWithType:UIButtonTypeCustom];
        zanBtn.frame=CGRectMake(self.numOfZan.left-20*PERCEN-zanImg.size.width, bottomView.height-50*PERCEN, zanImg.size.width, zanImg.size.height);
        [zanBtn setImage:zanImg forState:0];
        [zanBtn addTarget:self action:@selector(clickZan) forControlEvents:UIControlEventTouchUpInside];
        [bottomView addSubview:zanBtn];
        
        //故事滚动区域
        storyView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, bottomView.width, bottomView.height-80*PERCEN)];
        [bottomView addSubview:storyView];
        //内容区域
        _contentLb = [[UILabel alloc]initWithFrame:CGRectMake(30*PERCEN ,20*PERCEN  ,storyView.width-60*PERCEN,storyView.height-40*PERCEN)];
        _contentLb.backgroundColor = [UIColor clearColor];
        _contentLb.textAlignment = NSTextAlignmentLeft;
        _contentLb.textColor = UIColorFromHex(0xffffff);
        _contentLb.font = [UIFont systemFontOfSize:28*PERCEN];
        _contentLb.numberOfLines = 0;
        [storyView addSubview:_contentLb];

        //故事内容
       _contenetStr = @"翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。翻译的迷路之后是找回家，学呜呜希望发急能好搜秀呃逆是。";
        NSMutableParagraphStyle *mutStyle = [[NSMutableParagraphStyle alloc]init];
        mutStyle.lineSpacing = 16*PERCEN;
        NSMutableAttributedString *mutAttribute = [[NSMutableAttributedString alloc]initWithString:_contenetStr];
        [mutAttribute addAttribute:NSFontAttributeName value:_contentLb.font range:NSMakeRange(0, _contenetStr.length)];
        [mutAttribute addAttribute:NSParagraphStyleAttributeName value:mutStyle range:NSMakeRange(0, _contenetStr.length)];
        float heiht = [mutAttribute boundingRectWithSize:CGSizeMake(_contentLb.width, 1000) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:NULL].size.height+10;
        _contentLb.height = heiht;
        _contentLb.attributedText = mutAttribute;
        [storyView addSubview:_contentLb];
        storyView.contentSize=CGSizeMake(storyView.width, heiht);
        
        
    }else if(self.type == IdentityType_son){
#pragma mark ---本地亲子秀

        
        //1.评论区
        UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(_bigSongImg.right+120*PERCEN, 250*PERCEN, 858*PERCEN, _bigSongImg.height+120*PERCEN)];
        bottomView.backgroundColor = [UIColor clearColor];
        
        [blurryView addSubview:bottomView];
        
        _tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, bottomView.width, _bigSongImg.height) style:UITableViewStylePlain];
             _tableView.dataSource=self;
        _tableView.delegate=self;
        _tableView.backgroundColor=[UIColor clearColor];
        _tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
        [bottomView addSubview:_tableView];
       //2,统计区
        _bottomForSonView=[[MBBottomView alloc]initWithFrame:CGRectMake(0, _tableView.bottom, bottomView.width, 120*PERCEN)];
        _bottomForSonView.delegate=self;

        [bottomView addSubview:_bottomForSonView];
 
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieToEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieToFaile:) name:AVPlayerItemFailedToPlayToEndTimeNotification object:nil];

        
    }else if (self.type == IdentityType_listen){
#pragma mark ---大家都在听
        //大家都在听
        //歌词表格
        lrcTableView=[[UITableView alloc]initWithFrame:CGRectMake(_bigSongImg.right+138*PERCEN, _bigSongImg.top,SCREEN_WIDTH/2048*860 , SCREEN_WIDTH/2048*800) style:UITableViewStylePlain];
        lrcTableView.dataSource=self;
        lrcTableView.delegate=self;
        lrcTableView.separatorStyle= UITableViewCellSeparatorStyleNone;
        lrcTableView.backgroundColor=[UIColor clearColor];
        [blurryView addSubview:lrcTableView];
    }
    else{
        #pragma mark ---在线电台
        //在线电台
        //歌词表格
        lrcTableView=[[UITableView alloc]initWithFrame:CGRectMake(_bigSongImg.right+138*PERCEN, _bigSongImg.top,SCREEN_WIDTH/2048*860 , SCREEN_WIDTH/2048*800) style:UITableViewStylePlain];
        lrcTableView.dataSource=self;
        lrcTableView.delegate=self;
        lrcTableView.separatorStyle= UITableViewCellSeparatorStyleNone;
        lrcTableView.backgroundColor=[UIColor clearColor];
        [blurryView addSubview:lrcTableView];

    }
    
      noLrcView = [[UIView alloc]initWithFrame:lrcTableView.frame];
       noLrcView.backgroundColor = [UIColor clearColor];
       [blurryView addSubview:noLrcView];
    if (self.type==IdentityType_online) {
        [blurryView insertSubview:lrcTableView aboveSubview:noLrcView];
    }
  
    
}
#pragma mark----亲子秀播放器

- (void)movieToEnd:(NSNotification*)noty
{
    if (audioPlayer && [UserManager standerDefult].isBackPlay == NO) {
        AVPlayerItem *currentItem = noty.object;
        if ([audioPlayer.currentItem isEqual:currentItem]) {
            [self autoPlay];
        }
    }
}

- (void)movieToFaile:(NSNotification *)noty
{
    if (audioPlayer && [UserManager standerDefult].isBackPlay == NO) {
        AVPlayerItem *currentItem = noty.object;
        if ([audioPlayer.currentItem isEqual:currentItem]) {
            [self autoPlay];
        }
    }
}



#pragma mark---buttonView.delegate

- (void)onSelectCollectionMusicWithValue:(id)value //收藏
{
    
    UserModel *model = [UserManager standerDefult].userModel;
    if (!model.UserID) {
        MBLoginController *registerLastVC = [[MBLoginController alloc] init];
        registerLastVC.formBaseViewCtrl = NSStringFromClass([self class]);
        [self.navigationController pushViewController:registerLastVC animated:YES];
        return;
    }
    
    if (!model) return;
    
    //区分收藏和未收藏
    NSString *idStr = [NSString stringWithFormat:@"%@",currentMusic.ID];
    if ([collectionMusicArr containsObject:idStr]) {
        //取消收藏
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:SPACE_COLLECTION_REMOVE_URL_PATH,model.UserID,currentMusic.ID,@1] view:nil success:^(id json) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            if ([json[@"ret_code"] integerValue]==0) {
                //取消点赞成功
                [buttonView onUpdateCollection:NO];
                
                //数据更新
                [collectionMusicArr removeObject:idStr];
                [[UserManager standerDefult].collectionMusicArr removeAllObjects];
                [[UserManager standerDefult].collectionMusicArr addObjectsFromArray:collectionMusicArr];
            } else {
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    } else  {
        //收藏
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:SPACE_COLLECTION_COLLECION_URL_PATH,model.UserID,currentMusic.ID,@1] view:nil success:^(id json) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            if ([json[@"ret_code"] integerValue]==0) {
                //点赞成功
                [buttonView onUpdateCollection:YES];
                
                //数据更新
                [collectionMusicArr addObject:idStr];
                [[UserManager standerDefult].collectionMusicArr removeAllObjects];
                [[UserManager standerDefult].collectionMusicArr addObjectsFromArray:collectionMusicArr];
            } else {
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    }
}
- (void)onSelectPLayMusicTypeWithValue:(PLayerModelType)value //播放模式
{
    [buttonView onUpdatePlayMusicType:value];
    playModelType = value;

}
- (void)onSelectDownMusicWithValue:(id)value //下载歌曲
    {
        if (self.type==IdentityType_son) {
//            if (downloadBt.selected == YES) {
//                //已下载
//                return;
//            }
            
            NSDate *date = [NSDate date];
            NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
            [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
            NSString *dateString = [formatter stringFromDate:date];
            
            [[DownManager staredInstance]downloadWithUrl:currentMusic.urlPath
                                           withMusicName:[NSString stringWithFormat:@"%@.%@",currentMusic.name,currentMusic.type]
                                              withUserID:[NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"UserID"]]
                                             withMusicID:currentMusic.ID
                                             withContent:currentMusic.Sentiment
                                           withMusicType:[NSString stringWithFormat:@"%@",currentMusic.musicType]
                                              withPicUrl:currentMusic.CoverPath
                                                withDate:dateString
                                             withUserPic:[NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,[_dateDic objectForKey:@"FaceImg"]]
                                            withUserNick:[NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"NickName"]]
                                                withSize:[NSString stringWithFormat:@"%@",currentMusic.Capacity]
                                            withProgress:^(CGFloat progress, NSString *speed, NSString *remainingTime, NSString *writtenSize, NSString *totalSize) {
                                                
                                            } withStats:^(DownMusicState stats) {
                                                
                                            }];
        }else if (self.type==IdentityType_hot){
            NSDate *date = [NSDate date];
            NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
            [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
            NSString *dateString = [formatter stringFromDate:date];
            
            [[DownManager staredInstance]downloadWithUrl:currentMusic.urlPath
                                           withMusicName:[NSString stringWithFormat:@"%@.%@",currentMusic.name,currentMusic.type]
                                              withUserID:[NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"UserID"]]
                                             withMusicID:currentMusic.ID withContent:currentMusic.Sentiment
                                           withMusicType:[NSString stringWithFormat:@"%@",currentMusic.musicType]
                                              withPicUrl:currentMusic.CoverPath
                                                withDate:dateString
                                             withUserPic:[NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,[_dateDic objectForKey:@"FaceImg"]]
                                            withUserNick:[NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"NickName"]]
                                                withSize:[NSString stringWithFormat:@"%@",currentMusic.Capacity]
                                            withProgress:nil withStats:nil];
        }
        
        NSDictionary *dic = @{@"ID":currentMusic.ID,@"AudioPath":currentMusic.AudioPath,@"AudioStatus":currentMusic.AudioStatus,@"AudioName":[NSString stringWithFormat:@"%@.%@",currentMusic.name,currentMusic.type]};
        [[UserManager standerDefult]downLoadMusic:dic withRequestArr:fileIDArr];
        [ErrorMessage showErrorMessage:@"开始下载" inView:self.view];
    }
- (void)onSelectShareMusicWithValue:(id)value //分享
    {
        NSLog(@"分享");
        [shareView setShareVC:self content:[NSString stringWithFormat:@"分享:%@",currentMusic.name] image:[UIImage imageNamed:@"logo_dl_29"] url:[NSString stringWithFormat:SHARE_MUSIC_URL_PATH,currentMusic.ID]];
        [shareView addAudioId:[NSString stringWithFormat:@"%@",currentMusic.ID] withType:@1];
        [shareView show];
    }
#pragma mark--bottomForSonView.delegate
- (void)onSelectItemPraiseWithView:(MBBottomView *)view withValue:(id)value     //点赞

{
    
    UserModel *model = [UserManager standerDefult].userModel;
    if (!model.UserID) {
        MBLoginController *registerLastVC = [[MBLoginController alloc] init];
        registerLastVC.formBaseViewCtrl = NSStringFromClass([self class]);
        [self.navigationController pushViewController:registerLastVC animated:YES];
        return;
    }
    
    if (![value isKindOfClass:[NSDictionary class]]) return;
    if (!model) return;
    
 

    NSString*PraiseStatus=[NSString stringWithFormat:@"%@",value[@"PraiseStatus"]];
    
   
    if ([PraiseStatus isEqualToString:@"1"]) {
        
        
        NSString*url=[NSString stringWithFormat:FORUM_CANCEL_ZAN_URL_PATH,model.UserID,_dateDic[@"ID"],@1];
        
     
        //取消点赞
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [[HTTPManager standerDefault]AFGetRequest:url view:nil success:^(id json) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
           
            if ([json[@"ret_code"] integerValue]==0) {
                //取消点赞成功
                [_bottomForSonView onChangePraiseDate:NO];
                NSMutableDictionary *nDic = [[NSMutableDictionary alloc]initWithDictionary:value];
                [nDic setObject:@0 forKey:@"PraiseStatus"];
                [nDic setObject:[NSString stringWithFormat:@"%d",[[value objectForKey:@"PraiseNum"] intValue]-1] forKey:@"PraiseNum"];
                [_bottomForSonView setDataDic:nDic];
                
            } else {
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    } else  {
        //点赞
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:FORUM_ZAN_URL_PATH,model.UserID,_dateDic[@"ID"],@1] view:nil success:^(id json) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            if ([json[@"ret_code"] integerValue]==0) {
                //点赞成功
                NSMutableDictionary *nDic = [[NSMutableDictionary alloc]initWithDictionary:value];
                [nDic setObject:@1 forKey:@"PraiseStatus"];
                [nDic setObject:[NSString stringWithFormat:@"%d",[[value objectForKey:@"PraiseNum"] intValue]+1] forKey:@"PraiseNum"];
                [_bottomForSonView setDataDic:nDic];
            } else {
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    }
    
}
- (void)onselectItemForShouCangWithView:(MBBottomView *)view withValue:(id)value;     //收藏
{
    UserModel *model = [UserManager standerDefult].userModel;
    if (!model.UserID) {
        MBLoginController *registerLastVC = [[MBLoginController alloc] init];
        registerLastVC.formBaseViewCtrl = NSStringFromClass([self class]);
        [self.navigationController pushViewController:registerLastVC animated:YES];
        return;
    }
    
    if (![value isKindOfClass:[NSDictionary class]]) return;
    if (!model) return;
    
    //区分收藏和未收藏
    
    NSString*CollectStatus=[NSString stringWithFormat:@"%@",value[@"CollectStatus"]];
    
    
    
    if ([CollectStatus isEqualToString:@"1"]) {
        //取消收藏
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:SPACE_COLLECTION_REMOVE_URL_PATH,model.UserID,_dateDic[@"ID"],@3] view:nil success:^(id json) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            if ([json[@"ret_code"] integerValue]==0) {
                //取消点赞成功
                [_bottomForSonView onChangeCollectionDate:NO];
                NSMutableDictionary *nDic = [[NSMutableDictionary alloc]initWithDictionary:value];
                [nDic setObject:@0 forKey:@"CollectStatus"];
                [nDic setObject:[NSString stringWithFormat:@"%d",[[value objectForKey:@"CollectNum"] intValue]-1] forKey:@"CollectNum"];
                [_bottomForSonView setDataDic:nDic];
                
                //数据更新
                NSString *ids = [NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"ID"]];
                [collectionMusicArr removeObject:ids];
                [[UserManager standerDefult].collectionMusicArr removeAllObjects];
                [[UserManager standerDefult].collectionMusicArr addObjectsFromArray:collectionMusicArr];
                
            } else {
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    } else  {
        //收藏
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:SPACE_COLLECTION_COLLECION_URL_PATH,model.UserID,_dateDic[@"ID"],@3] view:nil success:^(id json) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            if ([json[@"ret_code"] integerValue]==0) {
                //点赞成功
                [_bottomForSonView onChangeCollectionDate:YES];
                NSMutableDictionary *nDic = [[NSMutableDictionary alloc]initWithDictionary:value];
                [nDic setObject:@1 forKey:@"CollectStatus"];
                [nDic setObject:[NSString stringWithFormat:@"%d",[[value objectForKey:@"CollectNum"] intValue]+1] forKey:@"CollectNum"];
                [_bottomForSonView setDataDic:nDic];
                
                //数据更新
                NSString *ids = [NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"ID"]];
                [collectionMusicArr addObject:ids];
                [[UserManager standerDefult].collectionMusicArr removeAllObjects];
                [[UserManager standerDefult].collectionMusicArr addObjectsFromArray:collectionMusicArr];
            } else {
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    }
    
}
- (void)onSelectITemForCommentWithView:(MBBottomView *)view  //评论
{
    MBSpaceNewsDetailViewController*com=[[MBSpaceNewsDetailViewController alloc]init];
    com.dataArr = _commentDateArr;
    com.isFormMyNews = NO;
    com.taUserID = [NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"UserID"]];

    
    [self.navigationController pushViewController:com animated:YES];
}

-(void)onSelectITemForShareWithView:(MBBottomView *)view withValue:(NSDictionary *)value{
    
    if (![value isKindOfClass:[NSDictionary class]]) return;
    if (value.allKeys.count > 0) {
        [shareView setShareVC:self content:[NSString stringWithFormat:@"分享:%@",currentMusic.name] image:[UIImage imageNamed:@"logo_dl_29"] url:[NSString stringWithFormat:SHARE_MUSIC_URL_PATH,currentMusic.ID]];
        [shareView addAudioId:[NSString stringWithFormat:@"%@",currentMusic.ID] withType:@1];
        [shareView show];
    }
}

#pragma mark--- 点赞
-(void)clickZan{

    
   
    
    NSString *CollectStatus =[NSString stringWithFormat:@"%@",  statusDic[@"CollectStatus"]];
    NSString *PraiseNum = [NSString stringWithFormat:@"%@",statusDic[@"PraiseNum"]];
    NSString *PraiseStatus =[NSString stringWithFormat:@"%@", statusDic[@"PraiseStatus"]];
    
    UserModel *model = [UserManager standerDefult].userModel;
    
    if ([PraiseStatus isEqualToString:@"1"]) {
        
        
        NSString*url=[NSString stringWithFormat:FORUM_CANCEL_ZAN_URL_PATH,model.UserID,currentMusic.ID,@1];
        
        
        //取消点赞
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [[HTTPManager standerDefault]AFGetRequest:url view:nil success:^(id json) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            if ([json[@"ret_code"] integerValue]==0) {
                //取消点赞成功
                [_bottomForSonView onChangePraiseDate:NO];
                int praiseNu = [[statusDic objectForKey:@"PraiseNum"] intValue]-1;
                praiseNu = praiseNu >= 0 ? praiseNu : 0;
              
                [statusDic setObject:@0 forKey:@"PraiseStatus"];
                [statusDic setObject:[NSString stringWithFormat:@"%d",[PraiseNum intValue]-1] forKey:@"PraiseNum"];
                self.numOfZan.text=[NSString stringWithFormat:@"点赞(%d)",praiseNu];
                 self.numOfZan.textColor = [UIColor whiteColor];
                [zanBtn setImage:[UIImage imageNamed:@"zan1"] forState:0];
                
                
            } else {
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    } else  {
        //点赞
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:FORUM_ZAN_URL_PATH,model.UserID,currentMusic.ID,@1] view:nil success:^(id json) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            if ([json[@"ret_code"] integerValue]==0) {
                //点赞成功
                [_bottomForSonView onChangePraiseDate:YES];
            
                int praiseNu = [[statusDic objectForKey:@"PraiseNum"] intValue]+1;
                praiseNu = praiseNu >= 0 ? praiseNu : 0;
                
                [statusDic setObject:@1 forKey:@"PraiseStatus"];
                [statusDic setObject:[NSString stringWithFormat:@"%d",[PraiseNum intValue]+1] forKey:@"PraiseNum"];
                self.numOfZan.text=[NSString stringWithFormat:@"点赞(%d)",praiseNu];
                [zanBtn setImage:[UIImage imageNamed:@"zan2"] forState:0];
                   self.numOfZan.textColor = TINK_COLOR;
               
                
            } else {
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    }

    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    _praiseListArr = [[NSMutableArray alloc]init];
 

    // Do any additional setup after loading the view.
    //UI布局
    statusDic=[[NSMutableDictionary alloc]init];

   
    
    
    
  
    
    [self creatUI];
    
    
    
    
    isPlay = YES;            //是否处于播放状态
    isCircle = YES;          //判断是否允许循环播放
    lrcLineNumber = 0;
    musicArrayNumber = 0;    //歌曲列表中第几条
    timeArray = [[NSMutableArray alloc] initWithCapacity:10];               //时间
    LRCDictionary = [[NSMutableDictionary alloc] initWithCapacity:10];      //歌词
    collectionMusicArr = [[NSMutableArray alloc]init];                             //收藏
    _commentDateArr=[NSMutableArray new];

    downedMusicArr=[[NSMutableArray alloc]init];
    
    
    
     nextPlay = 1;
    
    
    
    if (self.type==IdentityType_online|self
        .type==IdentityType_listen) {
        
        _dateDic=[self.dataAllArr objectAtIndex:0 ];
    
        //初始化要加载的曲目
        [self initDate];
        //初始化歌词词典
        [self initLRC];
        

    }
    
     //亲子秀获取数据
    if (self.type ==IdentityType_son) {
        _dateDic=[[NSMutableDictionary alloc]init];
        
        [self initDateForSon];
        [self getCommentMsg];
    }
    
    if (self.type==IdentityType_hot) {
        [self reloadUIForHot];
    }
    
     //    NSLog(@"currentDatedic==%@",_dateDic);

    //UI
    [self setupNavBar];
    [self onCreateUI];
 
    
    self.view.backgroundColor = [UIColor whiteColor];
    shareView = [[CLShareManager alloc] init];

    
    [progressSlider setThumbImage:[UIImage imageNamed:@"lunbo1"] forState:UIControlStateNormal];

}
#pragma mark--人气主播
-(void)reloadUIForHot{
    
    if (![_dateDic[@"FaceImg"] isKindOfClass:[NSNull class]]) {
        [self.headerImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",MUSIC_PLAY_Url,_dateDic[@"FaceImg"]]] placeholderImage:[UIImage imageNamed:@"baba_zl" ]];
    }else{
        self.headerImg.image=[UIImage imageNamed:@"baba_zl" ];
    }
    if (![_dateDic[@"CoverPath"] isKindOfClass:[NSNull class]]) {
        [_bigSongImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,_dateDic[@"CoverPath"]]] placeholderImage:[UIImage imageNamed:@"bg_qzxbf"]];
    }else{
        _bigSongImg.image =[UIImage imageNamed:@"bg_qzxbf"];
    }
    songName.text=_dateDic[@"ShowTitle"];
    if (![_dateDic[@"CoverPath"] isKindOfClass:[NSNull class]]) {
        [_smallSongImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,_dateDic[@"CoverPath"]]] placeholderImage:[UIImage imageNamed:@"bg_qzxbf"]];
    }else{
        _smallSongImg.image =[UIImage imageNamed:@"bg_qzxbf"];
    }

    self.name.text=_dateDic[@"NickName"];
    self.instrcutionLab.text=_dateDic[@"Signature"];
    NSString*CreateTime= [NSString stringWithFormat:@"%@",  _dateDic[@"CreateTime"]];
    self.timeOnshow.text=[CreateTime getChaTime];
    [self onLoadData];
}
- (void)onLoadData
{
    NSString *url = [NSString stringWithFormat:STORY_GET_ANCHORAUDIO_URL_PATH,[_dateDic objectForKey:@"UserID"]];

    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    [[HTTPManager standerDefault]AFGetRequest:url view:nil success:^(id json) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        
        if ([json isKindOfClass:[NSDictionary class]]) {
            NSLog(@"11==%@",json);
  
            if ([json[@"ret_code"] integerValue]==0) {
                NSArray *arr = json[@"data"];
                if ([arr isKindOfClass:[NSArray class]]) {
                    [musicArray removeAllObjects];
                    [self onUpdateMusicArr:arr];
                  
                
                }
            }
        }
        
    } failure:^(NSError *error) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        
    }];
}

//将音频转化成music
- (void)onUpdateMusicArr:(NSArray *)arr
{
    
    NSMutableArray*dateArr=[NSMutableArray new];
    for (NSDictionary *dic in arr) {
        Music *music = [[Music alloc]init];
        music.name = [NSString stringWithFormat:@"%@",[dic objectForKey:@"ShowTitle"]];
        NSString *filePath = [dic objectForKey:@"FilePath"];
        NSString *type = @"";
        if (![filePath isKindOfClass:[NSNull class]]) {
            type = [[filePath componentsSeparatedByString:@"."]lastObject];
            
            music.type = type;
            music.urlPath = [NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,filePath];
            NSArray *qzxArr = [[FMManageObject standerDefault]SelectTableByLocalParentChildShowWithUserId:[NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"UserID"]] withMusicId:[NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"ID"]]];
            music.isCacheData = (qzxArr.count > 0 ? YES : NO);
            
        }
        music.ID = [NSString stringWithFormat:@"%@",[dic objectForKey:@"ID"]];
        music.AudioPath = [NSString stringWithFormat:@"%@",filePath];
        music.Capacity = [NSString stringWithFormat:@"%@",[dic objectForKey:@"Capacity"]];
        music.Sentiment = [NSString stringWithFormat:@"%@",[dic objectForKey:@"Sentiment"]];
        music.AudioStatus = @"1";
        music.LyricPath = @"";
        NSString *CoverPath = [dic objectForKey:@"CoverPath"];
        if (![CoverPath isKindOfClass:[NSNull class]]) {
            music.CoverPath = [NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,CoverPath];
        }
        [dateArr addObject:music];
        
    }
    musicArray=[NSMutableArray arrayWithArray:dateArr];
  
    //已下载歌曲记录
    NSArray *downedMusicArr1 = [[FMManageObject standerDefault]onSelectLocalParentChildShowCount];
    fileIDArr = [[NSMutableArray alloc]initWithCapacity:downedMusicArr1.count];
    for (int i=0; i<downedMusicArr1.count; i++) {
        NSDictionary *dic = [downedMusicArr1 objectAtIndex:i];
        NSString *fileID = [dic objectForKey:@"musicId"];
        [fileIDArr addObject:fileID];
    }
    
    //时时更新
    [self initDateforHot];
    
    //歌曲列表保存
    [NSKeyedArchiver archiveRootObject:musicArray toFile:[MusicCachesDirectory stringByAppendingPathComponent:@"collectionMusic.data"]];
    [[NSUserDefaults standardUserDefaults]setObject:[NSString stringWithFormat:@"%d",(int)musicArrayNumber] forKey:@"music_list_CurrentNum"];
    [[NSUserDefaults standardUserDefaults]synchronize];
    
    
    [self setPlayer];
}


- (void)onUpdateUIFOrScrollView:(NSString *)segment
{
    NSString *str =segment;
    NSMutableParagraphStyle *mutStyle = [[NSMutableParagraphStyle alloc]init];
    mutStyle.lineSpacing =  16*PERCEN;
    
    NSMutableAttributedString *mutAttribute = [[NSMutableAttributedString alloc]initWithString:str];
    [mutAttribute addAttribute:NSFontAttributeName value:_contentLb.font range:NSMakeRange(0, str.length)];
    [mutAttribute addAttribute:NSParagraphStyleAttributeName value:mutStyle range:NSMakeRange(0, str.length)];
    float heiht = [mutAttribute boundingRectWithSize:CGSizeMake(_contentLb.width, 1000) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:NULL].size.height+10;
    _contentLb.height = heiht;
    _contentLb.attributedText = mutAttribute;

    storyView.contentSize=CGSizeMake(storyView.width, heiht);
}




-(void)initDateforHot{
    //获取当前的歌曲信息
    
    
    
    if (musicArray.count > musicArrayNumber) {
        currentMusic = musicArray[musicArrayNumber];
        
      //  titleLb.text = [currentMusic name];
        [_bigSongImg sd_setImageWithURL:[NSURL URLWithString:currentMusic.CoverPath] placeholderImage:[UIImage imageNamed:@"jiatu"]];
        self.title=[currentMusic name];
       _contentLb.text=currentMusic.Sentiment;
        [self onUpdateUIFOrScrollView:currentMusic.Sentiment];
       
    }
    
    
   
    //下载状态
    BOOL isDown = NO;
    for (NSString *fileID in fileIDArr) {
        if ([fileID isEqualToString:[NSString stringWithFormat:@"%@",currentMusic.ID]]) {
            isDown = YES;
        }
    }
    
    [buttonView onUpdateDown:isDown withModel:currentMusic];
    UserModel *model = [UserManager standerDefult].userModel;
    if (model) {
        NSString *url = [NSString stringWithFormat:STORY_STATUSLISt_URL_PATH,model.UserID,currentMusic.ID,[_dateDic objectForKey:@"UserID"]];
        
        NSLog(@"url==%@",url);
        [[HTTPManager standerDefault]AFGetRequest:url view:nil success:^(id json) {
            
            NSLog(@"json123==%@",json);
            if ([json isKindOfClass:[NSDictionary class]]) {
                
                [statusDic removeAllObjects];
                [statusDic addEntriesFromDictionary:json];
                
                NSString *CollectStatus = json[@"CollectStatus"];
                NSString *PraiseNum = json[@"PraiseNum"];
                NSString *PraiseStatus = json[@"PraiseStatus"];
                
               
                
                if ([PraiseStatus intValue] == 1) {
                    //点赞点亮
                    [zanBtn setImage:[UIImage imageNamed:@"zan2_qzxbf"] forState:0  ];
                    _numOfZan.textColor = TINK_COLOR;
                } else {
                  [zanBtn setImage:[UIImage imageNamed:@"zan1"] forState:0  ];
                    _numOfZan.textColor = [UIColor whiteColor];
                }
                _numOfZan.text = [NSString stringWithFormat:@"点赞(%@)",PraiseNum];
                if ([CollectStatus intValue] == 1) {
                    //收藏点亮
                    
                    [buttonView onUpdateCollection:YES];

                } else {
                     [buttonView onUpdateCollection:NO];

                }
            }
        } failure:^(NSError *error) {
            
        }];
    }


}
- (void)setPlayer
{
    
    if ([UserManager standerDefult].mainPlayer) {
        if ([UserManager standerDefult].isPlaying) {
            _showTimer =[NSTimer scheduledTimerWithTimeInterval:0.1f
                                                         target:self
                                                       selector:@selector(showTime)
                                                       userInfo:nil
                                                        repeats:YES];
        }
        audioPlayer = [UserManager standerDefult].mainPlayer;
        isFromBackGround = YES;
        [[UserManager standerDefult] setIsBackPlay:NO];
        
        if (![self.selectMusicID isEqualToString:[NSString stringWithFormat:@"%@",currentMusic.ID]]) {
            NSURL *urlPath = [NSURL URLWithString:[NSString stringWithFormat:@"%@",currentMusic.urlPath]];
            [audioPlayer replaceCurrentItemWithPlayerItem:[AVPlayerItem playerItemWithURL:urlPath]];
        }
        
        //数据
        playBtn.selected = [UserManager standerDefult].isPlaying;
        if (playBtn.selected) {
            [audioPlayer play];
        } else {
            [audioPlayer pause];
        }
        isPlay = !playBtn.selected;
    } else {
        NSURL *urlPath;
        if (currentMusic.isCacheData) {
            NSString *filePath = [MusicCachesDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",currentMusic.urlPath]];
            urlPath = [NSURL fileURLWithPath:filePath];
        } else {
            urlPath = [NSURL URLWithString:currentMusic.urlPath];
        }
        
        AVPlayerItem *item =[AVPlayerItem playerItemWithURL:urlPath];
        audioPlayer = [[AVPlayer alloc]initWithPlayerItem:item];
        isFromBackGround = NO;
    }
    
    [self showTime];
}
#pragma mark---共用UI部分
- (void)onCreateUI
{
    
    if ([UserManager standerDefult].mainPlayer) {
        if ([UserManager standerDefult].isPlaying) {
            _showTimer =[NSTimer scheduledTimerWithTimeInterval:0.1f
                                                         target:self
                                                       selector:@selector(showTime)
                                                       userInfo:nil
                                                        repeats:YES];
        }
        audioPlayer = [UserManager standerDefult].mainPlayer;
        isFromBackGround = YES;
        [[UserManager standerDefult] setIsBackPlay:NO];
        //亲子秀
        if (self.type==IdentityType_son) {
            if (![self.selectMusicID isEqualToString:[NSString stringWithFormat:@"%@",currentMusic.ID]]) {
                NSURL *urlPath = [NSURL URLWithString:[NSString stringWithFormat:@"%@",currentMusic.urlPath]];
                [audioPlayer replaceCurrentItemWithPlayerItem:[AVPlayerItem playerItemWithURL:urlPath]];
            }
            

        }
        
        
        //歌词滚动
        [lrcTableView setContentOffset:[UserManager standerDefult].mainPoint animated:NO];
        
        //数据
        [musicArray removeAllObjects];
        [musicArray addObjectsFromArray:[UserManager standerDefult].musicArr];
        musicArrayNumber = [UserManager standerDefult].selectMusicIndex;
        playBtn.selected = [UserManager standerDefult].isPlaying;
        if (playBtn.selected) {
            [audioPlayer play];
        } else {
            [audioPlayer pause];
        }
        isPlay = !playBtn.selected;

    } else {
        NSURL *urlPath;
        if (currentMusic.isCacheData) {
            NSString *filePath = [MusicCachesDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",currentMusic.urlPath]];
            urlPath = [NSURL fileURLWithPath:filePath];
        } else {
            urlPath = [NSURL URLWithString:currentMusic.urlPath];
        }
        
        AVPlayerItem *item =[AVPlayerItem playerItemWithURL:urlPath];
        audioPlayer = [[AVPlayer alloc]initWithPlayerItem:item];
       isFromBackGround = NO;
    }
    
    [self play:playBtn];
   
}


- (void)setupNavBar {
    [self setTitleView:[musicArray[musicArrayNumber] name]];
    if (_isFromOnLine) {
        songName.hidden = NO;
        singer.hidden = NO;
    } else {
        songName.hidden = YES;
        singer.hidden = YES;
    }
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"fanhui"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]style:UIBarButtonItemStylePlain target:self action:@selector(navigationBackButton)];
}

-(void)navigationBackButton {
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark 载入歌曲数组
- (void)initDate {
    //获取音频列表的歌曲数据
    NSMutableArray *musicArr = [UserManager standerDefult].musicArr;
    if (musicArr.count > 0) {
        musicArray = [[NSMutableArray alloc]initWithArray:musicArr];
    }

    musicArrayNumber = [UserManager standerDefult].selectMusicIndex;
    
    //获取当前的歌曲信息
    if (musicArray.count > musicArrayNumber) {
        currentMusic = musicArray[musicArrayNumber];
  
    }
    

    
    //已下载歌曲记录
    NSArray *downedMusicArr1 = [UserManager standerDefult].downedMusicArr;
    fileIDArr = [[NSMutableArray alloc]initWithCapacity:downedMusicArr1.count];
    for (int i=0; i<downedMusicArr1.count; i++) {
        NSDictionary *dic = [downedMusicArr1 objectAtIndex:i];
        NSString *fileID = [dic objectForKey:@"fileID"];
        [fileIDArr addObject:fileID];
    }
    
    //播放模式
    NSString *modelType = [[NSUserDefaults standardUserDefaults]objectForKey:@"player_model_type"];
    if (modelType.length == 0) {
        playModelType = PLayerModelType_Shunxu;
    } else {
        switch ([modelType intValue]) {
            case 1:
            {
                playModelType = PLayerModelType_Shunxu;
            }
                break;
            case 2:
            {
                playModelType = PLayerModelType_SuiJi;
            }
                break;
            case 3:
            {
                playModelType = PLayerModelType_DanQu;
            }
                break;
                
            default:
            {
                playModelType = PLayerModelType_Shunxu;
            }
                
                break;
        }
    }
    
    //歌曲列表保存
    [NSKeyedArchiver archiveRootObject:musicArray toFile:[MusicCachesDirectory stringByAppendingPathComponent:@"collectionMusic.data"]];
}
#pragma mark 0.1秒一次更新 播放时间 播放进度条 歌词 歌曲 自动播放下一首
- (void)showTime {
    //动态更新进度条时间
    int currentTime = 0;
    int durationTime = 0;
    if (audioPlayer.currentItem.currentTime.timescale != 0) {
        currentTime = (int)(audioPlayer.currentItem.currentTime.value / audioPlayer.currentItem.currentTime.timescale);
    }
    if (audioPlayer.currentItem.duration.timescale != 0) {
        durationTime = (int) (audioPlayer.currentItem.duration.value / audioPlayer.currentItem.duration.timescale);
    }
    if ((int)currentTime % 60 < 10) {
        currentTimeLabel.text = [NSString stringWithFormat:@"%d:0%d",(int)currentTime / 60, (int)currentTime % 60];
    } else {
        currentTimeLabel.text = [NSString stringWithFormat:@"%d:%d",(int)currentTime / 60, (int)currentTime % 60];
    }
    //
    if ((int)durationTime % 60 < 10) {
        totalTimeLabel.text = [NSString stringWithFormat:@"%d:0%d",(int)durationTime / 60, (int)durationTime % 60];
    } else {
        totalTimeLabel.text = [NSString stringWithFormat:@"%d:%d",(int)durationTime / 60, (int)durationTime % 60];
    }
    progressSlider.value = 1.0 * currentTime / durationTime;
    if ([totalTimeLabel.text isEqualToString:@"0:00"]) {
        ++nextPlay;
        if (nextPlay == 8) {
            [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        }
        if (nextPlay == 60) {
            [audioPlayer replaceCurrentItemWithPlayerItem:nil];
            [self autoPlay];
            nextPlay = 1;
            [audioPlayer play];
            return;
        }
    } else {
        [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
        nextPlay = 1;
    }
   // NSLog(@"当前时间:%@，总时间:%@,进度：%.2f",currentTimeLabel.text,totalTimeLabel.text,progressSlider.value);
    
    //收藏状态
    
    
    if (lrcTableView.isHidden == NO) {
        [self displaySondWord:currentTime];//调用歌词函数
    }
    
    //如果播放完，调用自动播放下一首
    if (progressSlider.value > 0.999) {
        [self autoPlay];
    }
}
- (void)onChangeCollectionType
{
    //播放当前歌曲时，判断是否该歌曲收藏
    BOOL isPraise = NO;
    for (NSString *praiseType in collectionMusicArr) {
        if ([praiseType intValue] == [currentMusic.ID intValue]) {
            isPraise = YES;
        }
    }
    [buttonView onUpdateCollection:isPraise];}
#pragma mark 得到歌词
- (void)initLRC {
    if (self.type==IdentityType_online|self.type==IdentityType_listen) {
      // [[UserManager standerDefult].collectionMusicArr removeAllObjects];
        
        //收藏歌曲
        NSArray *musicCollecion = [UserManager standerDefult].collectionMusicArr;
        
        [collectionMusicArr removeAllObjects];
        
        if (musicCollecion.count > 0) {
            [collectionMusicArr addObjectsFromArray:musicCollecion];
        }
        [self onChangeCollectionType];
        [self getAudioStatus];
        
        //下载状态
        BOOL isDown = NO;
        for (NSString *fileID in fileIDArr) {
            if ([fileID isEqualToString:[NSString stringWithFormat:@"%@",currentMusic.ID]]) {
                isDown = YES;
            }
        }
        [buttonView onUpdateDown:isDown withModel:currentMusic];
        
        //列入最近播放
        if (currentMusic.ID) {
            FMManageObject *manager = [FMManageObject standerDefault];
            NSArray *arrs = [manager SelectTableByMusicPlayForRecentWithContentID:[NSString stringWithFormat:@"%@",currentMusic.ID]];
            if (arrs.count == 0) {
                //来吧
                [manager insertTableMusicPlayForRecentWithId:@"1" withFileName:currentMusic.name withFileID:currentMusic.ID withUrl:currentMusic.urlPath withSize:currentMusic.Capacity withType:[NSString stringWithFormat:@"%@",currentMusic.musicType]];
            }
        }
        
        
        
        if (musicArray.count > musicArrayNumber) {
            [timeArray removeAllObjects];
            [LRCDictionary removeAllObjects];
            
            //        if (currentMusic.isCacheData == NO) {
            //            //无歌词
            //            [self addNoGeCi];
            //            return;
            //        }
            
            NSString *lrcPath = currentMusic.LyricPath;
            
            if ([lrcPath isKindOfClass:[NSNull class]]) {
                [self addNoGeCi];
                return;
            }
//            
//            if ([lrcPath isEqualToString:@""]) {
//                [self addNoGeCi];
//                return;
//            }
                NSString *AudioName = currentMusic.name;
                AudioName = [AudioName componentsSeparatedByString:@"."][0];
                NSString *lrcString;
                if (![lrcPath isKindOfClass:[NSNull class]] && AudioName.length > 0) {
                    //音频歌词下载
                    NSString *path = [NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,lrcPath];
                    path = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                    NSURL *url = [NSURL URLWithString:path];
                    NSData *date = [NSData dataWithContentsOfURL:url];
                    lrcString = [[NSString alloc]initWithData:date encoding:NSUTF8StringEncoding];
                    if (lrcString.length == 0) {
                        unsigned long encode = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
                        lrcString = [[NSString alloc] initWithData:date encoding:encode];
                    }
                    
                }
                
         
            
            

            lrcTableView.hidden = NO;
           [noLrcView removeAllSubviews];
            NSArray *array = [lrcString componentsSeparatedByString:@"\n"];
            for (int i = 0; i < [array count]; i++) {
                NSString *linStr = [array objectAtIndex:i];
                NSArray *lineArray = [linStr componentsSeparatedByString:@"]"];
                if ([lineArray[0] length] > 8) {
                    NSString *str1 = [linStr substringWithRange:NSMakeRange(3, 1)];
                    NSString *str2 = [linStr substringWithRange:NSMakeRange(6, 1)];
                    if ([str1 isEqualToString:@":"] && [str2 isEqualToString:@"."]) {
                        NSString *lrcStr = [lineArray objectAtIndex:1];
                        NSString *timeStr = [[lineArray objectAtIndex:0] substringWithRange:NSMakeRange(1, 5)];//分割区间求歌词时间
                        //把时间 和 歌词 加入词典
                        [LRCDictionary setObject:lrcStr forKey:timeStr];
                        [timeArray addObject:timeStr];//timeArray的count就是行数
                    }
                }
            }
            [lrcTableView reloadData];
            
        } else {

            [self addNoGeCi];
        }
 
    }
    
    //当前第几首歌以及类型播放器
    [[NSUserDefaults standardUserDefaults]setObject:[NSString stringWithFormat:@"%d",(int)musicArrayNumber] forKey:@"music_list_CurrentNum"];
    [[NSUserDefaults standardUserDefaults]setObject:[NSString stringWithFormat:@"%d",(int)3] forKey:@"music_Type_CurrentNum"];
    [[NSUserDefaults standardUserDefaults]synchronize];
    
      }
#pragma mark---暂无歌词

-(void)addNoGeCi{
    
    
    //无歌曲
  
    [noLrcView removeAllSubviews];
  
    lrcTableView.hidden = YES;
    
    UIImage *img = [UIImage imageNamed:@"zanwugeci"];
    UIImageView *imgLrcView = [[UIImageView alloc]initWithFrame:CGRectMake((noLrcView.width-img.size.width)/2., ((noLrcView.height - img.size.height - 20)/2.), img.size.width, img.size.height)];
    imgLrcView.image = img;
    imgLrcView.backgroundColor = [UIColor clearColor];
    [noLrcView addSubview:imgLrcView];
    
    UILabel *noLrcLb = [[UILabel alloc]initWithFrame:CGRectMake(0, imgLrcView.bottom+20, noLrcView.width, 20)];
    noLrcLb.text =@"暂无歌词";
    noLrcLb.textAlignment = NSTextAlignmentCenter;
    noLrcLb.textColor = [UIColor whiteColor];
    noLrcLb.font = [UIFont systemFontOfSize:14.f];
    [noLrcView addSubview:noLrcLb];
    
}
#pragma mark 动态显示歌词
- (void)displaySondWord:(NSUInteger)time {
    //    NSLog(@"time = %u",time);
    for (int i = 0; i < [timeArray count]; i++) {
        
        NSArray *array = [timeArray[i] componentsSeparatedByString:@":"];//把时间转换成秒
        NSUInteger currentTime = [array[0] intValue] * 60 + [array[1] intValue];
        if (i == [timeArray count]-1) {
            //求最后一句歌词的时间点
            NSArray *array1 = [timeArray[timeArray.count-1] componentsSeparatedByString:@":"];
            NSUInteger currentTime1 = [array1[0] intValue] * 60 + [array1[1] intValue];
            if (time > currentTime1) {
                [self updateLrcTableView:i];
                break;
            }
        } else {
            //求出第一句的时间点，在第一句显示前的时间内一直加载第一句
            NSArray *array2 = [timeArray[0] componentsSeparatedByString:@":"];
            NSUInteger currentTime2 = [array2[0] intValue] * 60 + [array2[1] intValue];
            if (time < currentTime2) {
                [self updateLrcTableView:0];
                //                NSLog(@"马上到第一句");
                break;
            }
            //求出下一步的歌词时间点，然后计算区间
            NSArray *array3 = [timeArray[i+1] componentsSeparatedByString:@":"];
            NSUInteger currentTime3 = [array3[0] intValue] * 60 + [array3[1] intValue];
            if (time >= currentTime && time <= currentTime3) {
                [self updateLrcTableView:i];
                break;
            }
            
        }
    }
}

#pragma mark 动态更新歌词表歌词
- (void)updateLrcTableView:(NSUInteger)lineNumber {
    //重新载入 歌词列表lrcTabView
    lrcLineNumber = lineNumber;
    //    [lrcTableView reloadData];
    //    //使被选中的行移到中间
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:lineNumber inSection:0];
    [lrcTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
    //    [lrcTableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
    [lrcTableView reloadData];
    
    //表的显示区域最多显示的歌词行数
    int count = lrcTableView.height / TABLE_ROW_HEIGHT;
    count = count / 2;
    
    if (lineNumber > count) {
        //显示在这行时，开始往上移动一个单元格高度
        
        [lrcTableView setContentOffset:CGPointMake(0, TABLE_ROW_HEIGHT*(lineNumber-count)) animated:YES];
    } else {
        [lrcTableView setContentOffset:CGPointMake(0, 0) animated:YES];
    }
}




#pragma mark 播放目前的音乐
- (void)play:(id)sender {
    if (isPlay) {
        [audioPlayer play];
        [playBtn setImage: [UIImage imageNamed:@"zanting_dt"] forState:UIControlStateSelected];
        [playBtn setImage:[UIImage imageNamed:@"bofang_dt"]forState:UIControlStateNormal];
        playBtn.selected = !playBtn.selected;
        isPlay = NO;
        
        if (!_showTimer) {
            //设置监控 每秒刷新一次时间
            _showTimer =[NSTimer scheduledTimerWithTimeInterval:0.1f
                                                         target:self
                                                       selector:@selector(showTime)
                                                       userInfo:nil
                                                        repeats:YES];
        }
    } else {
        [audioPlayer pause];
        [playBtn setImage:[UIImage imageNamed:@"zanting_dt"] forState:UIControlStateSelected];
        [playBtn setImage:[UIImage imageNamed:@"bofang_dt"]forState:UIControlStateNormal];
        playBtn.selected = !playBtn.selected;
        isPlay = YES;
        
        if (_showTimer) {
            [_showTimer invalidate];
            _showTimer = nil;
        }
    }

}
#pragma mark 上一首
- (void)aboveMusic:(id)sender {
    if (playModelType == PLayerModelType_Shunxu) {
        //顺序
        if (musicArrayNumber == 0) {
            musicArrayNumber = musicArray.count;
        }
        musicArrayNumber --;
    }
    else if (playModelType == PLayerModelType_SuiJi) {
        musicArrayNumber = arc4random()%(musicArray.count);
    }
    else if (playModelType == PLayerModelType_DanQu) {
        
    }
    
    [self updatePlayerSetting];
}
#pragma mark 下一首
- (void)nextMusic:(id)sender {
    if (playModelType == PLayerModelType_Shunxu) {
        //顺序
        if (musicArrayNumber == musicArray.count - 1) {
            musicArrayNumber = -1;
        }
        musicArrayNumber ++;
    }
    else if (playModelType == PLayerModelType_SuiJi) {
        musicArrayNumber = arc4random()%(musicArray.count);
    }
    else if (playModelType == PLayerModelType_DanQu) {
        
    }
    
    [self updatePlayerSetting];

}
#pragma mark 自动进入下一首
- (void)autoPlay {
    if (playModelType == PLayerModelType_Shunxu) {
        //顺序
        if (musicArrayNumber == musicArray.count - 1) {
            musicArrayNumber = -1;
        }
        musicArrayNumber ++;
    }
    else if (playModelType == PLayerModelType_SuiJi) {
        musicArrayNumber = arc4random()%(musicArray.count);
    }
    else if (playModelType == PLayerModelType_DanQu) {
        
    }
    
    [self updatePlayerSetting];}

//更新播放器设置
- (void)updatePlayerSetting {
     [self setTitleView:[musicArray[musicArrayNumber] name]];
      if (self.type == IdentityType_son) {
        
        [[UserManager standerDefult]setSelectMusicIndex:musicArrayNumber];
        [self setTitleView:[musicArray[musicArrayNumber] name]];
        currentMusic = musicArray[musicArrayNumber];
        
        [self getCommentMsg];
        
        isPlay = YES;
        
        //更新曲目
        [audioPlayer pause];
        songName.text=[musicArray[musicArrayNumber] name];
        
        
        NSURL *urlPath;
        if (currentMusic.isCacheData) {
            NSString *filePath = [MusicCachesDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@",currentMusic.name,currentMusic.type]];
            urlPath = [NSURL fileURLWithPath:filePath];
        } else {
            urlPath = [NSURL URLWithString:currentMusic.urlPath];
        }
        
        AVPlayerItem *item =[AVPlayerItem playerItemWithURL:urlPath];
        [audioPlayer replaceCurrentItemWithPlayerItem:item];
        
        if (playBtn.selected == YES) {
            [audioPlayer play];
        } else {
            [audioPlayer pause];
        }
        
        //试听次数
        [self addAudioNumAction];

    }else if ( self.type ==IdentityType_online|self.type==IdentityType_listen){
    
        //更新播放按钮状态
        [playBtn setBackgroundImage:[UIImage imageNamed:@"zanting_dt"] forState:UIControlStateSelected];
        isPlay = NO;
        
        //更新曲目
        [audioPlayer pause];
        currentMusic = musicArray[musicArrayNumber];
     
        songName.text = [musicArray[musicArrayNumber] name];
        singer.text = [musicArray[musicArrayNumber] name];
        
        NSURL *urlPath;
        if (currentMusic.isCacheData) {
            NSString *filePath = [MusicCachesDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",currentMusic.urlPath]];
            urlPath = [NSURL fileURLWithPath:filePath];
        } else {
            urlPath = [NSURL URLWithString:currentMusic.urlPath];
        }
        
        AVPlayerItem *item =[AVPlayerItem playerItemWithURL:urlPath];
        [audioPlayer replaceCurrentItemWithPlayerItem:nil];
        [audioPlayer replaceCurrentItemWithPlayerItem:item];
        [audioPlayer play];
        
        //重新载入歌词词典
        [self initLRC];
    }
    else if (self.type==IdentityType_hot){
        //更新播放按钮状态
        isPlay = NO;
        
        //更新曲目
        [audioPlayer pause];
        currentMusic = musicArray[musicArrayNumber];
        
        [self initDateforHot];
        
        if (playBtn.selected == NO) {
            return;
        }
        NSURL *urlPath;
        if (currentMusic.isCacheData) {
            NSString *filePath = [MusicCachesDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",currentMusic.urlPath]];
            urlPath = [NSURL fileURLWithPath:filePath];
        } else {
            urlPath = [NSURL URLWithString:currentMusic.urlPath];
        }
        
        AVPlayerItem *item =[AVPlayerItem playerItemWithURL:urlPath];
        [audioPlayer replaceCurrentItemWithPlayerItem:nil];
        [audioPlayer replaceCurrentItemWithPlayerItem:item];
        [audioPlayer play];
        

    }
}
#pragma mark - 上传试听次数
- (void)addAudioNumAction
{
    [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:FAMILYSHOW_AUDIONUM_URL_PATH,[_dateDic objectForKey:@"ID"],@2] view:nil success:^(id json) {
        if ([json[@"ret_code"] integerValue]==0) {
            NSMutableDictionary *mutDics = [[NSMutableDictionary alloc]initWithDictionary:_dateDic];
            int praiseNu = [[mutDics objectForKey:@"AuditionNum"] intValue]+1;
            praiseNu = praiseNu >= 0 ? praiseNu : 0;
            [mutDics setValue:[NSString stringWithFormat:@"%d",praiseNu] forKey:@"AuditionNum"];
            [_dataAllArr replaceObjectAtIndex:(int)musicArrayNumber withObject:mutDics];
            [_dateDic removeAllObjects];
            [_dateDic addEntriesFromDictionary:mutDics];
        }
        
        
    } failure:^(NSError *error) {
        
    }];
}

- (void)progressChange:(id)sender {
    //    audioPlayer.currentTime = progressSlider.value * audioPlayer.duration;
    
    CGFloat duration = audioPlayer.currentItem.duration.value / audioPlayer.currentItem.duration.timescale;
    NSInteger dragedSeconds = floorf(duration*progressSlider.value);
    
    //转换成CMTime才能给player来控制播放进度
    CMTime dragedCMTime = CMTimeMake(dragedSeconds, 1);
    
    [audioPlayer pause];
    [_showTimer invalidate];
    _showTimer = nil;
    [audioPlayer seekToTime:dragedCMTime completionHandler:^(BOOL finish){
        if (finish) {
            if (!_showTimer) {
                //设置监控 每秒刷新一次时间
                _showTimer =[NSTimer scheduledTimerWithTimeInterval:0.1f
                                                             target:self
                                                           selector:@selector(showTime)
                                                           userInfo:nil
                                                            repeats:YES];
            }
            [audioPlayer play];
        }
        
    }];
}

- (IBAction)circle:(id)sender {
    if (isCircle) {
        circleBtn.alpha = 0.5;
        isCircle = NO;
    } else {
        circleBtn.alpha = 1.0;
        isCircle = YES;
    }
}

#pragma mark 表视图
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (self.type == IdentityType_son) {
        if (_commentDateArr.count>3) {
            return 3;
        }else{
            return _commentDateArr.count;
        }
       
    }
    return [timeArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.type == IdentityType_son) {
       
        
        ConmentCell*cell=[tableView dequeueReusableCellWithIdentifier:@"conmentCell"];
        
        if (!cell) {
            cell=[[ConmentCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"conmentCell"];
            
        }
        if (indexPath.row>_commentDateArr.count) {
            cell.dateDic=NULL;
        }else{
        cell.dateDic=_commentDateArr[indexPath.row];
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;//该表格选中后没有颜色
        cell.backgroundColor = [UIColorFromHex(0xffffff)colorWithAlphaComponent:.2];
        if (indexPath.row==2) {
            cell.line.hidden=YES;
        }
        
 
        return cell;
    }
    static NSString *cellIdentifier = @"LRCCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;//该表格选中后没有颜色
    cell.backgroundColor = [UIColor clearColor];
    
    if (indexPath.row == lrcLineNumber) {
        cell.textLabel.text = LRCDictionary[timeArray[indexPath.row]];
        cell.textLabel.textColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1.0];
        cell.textLabel.font = [UIFont systemFontOfSize:15];
    } else {
        cell.textLabel.text = LRCDictionary[timeArray[indexPath.row]];
        cell.textLabel.textColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
        cell.textLabel.font = [UIFont systemFontOfSize:13];
    }
    cell.textLabel.backgroundColor = [UIColor clearColor];
    cell.textLabel.textAlignment = NSTextAlignmentCenter;
    return cell;
}
//行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.type == IdentityType_son) {
        return 166*PERCEN;
    }
    return TABLE_ROW_HEIGHT;
}
//段尾
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    if (self.type == IdentityType_son) {
        
        UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, tableView.width, 120*PERCEN)];
        bgView.backgroundColor = [UIColor clearColor];
        bgView.userInteractionEnabled = YES;
        UIView *contentView = [[UIView alloc]initWithFrame:CGRectMake(0, 10*PERCEN, tableView.width, 90*PERCEN)];
        contentView.backgroundColor = [UIColorFromHex(0xffffff) colorWithAlphaComponent:.2];
        contentView.userInteractionEnabled = YES;
        [bgView addSubview:contentView];
        UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
        bt.frame = CGRectMake((contentView.width-140)/2 , 0, 140, contentView.height);
        bt.backgroundColor = [UIColor clearColor];
        [bt setTitle:@"查看所有评论 >>" forState:UIControlStateNormal];
        [bt setTitle:@"查看所有评论 >>" forState:UIControlStateHighlighted];
        [bt setTitleColor:UIColorFromHex(0xffffff) forState:UIControlStateNormal];
        [bt setTitleColor:UIColorFromHex(0xffffff) forState:UIControlStateHighlighted];
        bt.titleLabel.font = [UIFont systemFontOfSize:30*PERCEN];
        [bt addTarget:self action:@selector(onSelectForNewCellAction) forControlEvents:UIControlEventTouchUpInside];
        [contentView addSubview:bt];
        
        return bgView;
 
    }
    return nil;
    
}
-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForFooterInSection:(NSInteger)section{
    if (self.type ==IdentityType_son) {
          return 110*PERCEN;
    }
    return 0;
}
//段头
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    if (self.type == IdentityType_son) {
        UIView*headerView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, tableView.width, 190*PERCEN)];
        
        headerView.userInteractionEnabled=YES;
        //头像
        _headerImg=[[UIImageView alloc]initWithFrame:CGRectMake(30*PERCEN, 20*PERCEN, 150*PERCEN, 150*PERCEN)];
        headerView.backgroundColor = [UIColorFromHex(0xffffff) colorWithAlphaComponent:.3];
        _headerImg.layer.cornerRadius = _headerImg.height / 2.;
        if ([_dateDic[@"FaceImg"] isKindOfClass:[NSNull class]]) {
            _headerImg.image = [UIImage imageNamed:@"baba_zl"];
        }else{
        [_headerImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,_dateDic[@"FaceImg"]]] placeholderImage:[UIImage imageNamed:@"baba_zl"]];
        }
        
     //   _headerImg.image = [UIImage imageNamed:@"baba_zl"];
        _headerImg.layer.masksToBounds = YES;
        [headerView addSubview:_headerImg];
        
        //主播名
        self.name=[[UILabel alloc]initWithFrame:CGRectMake(_headerImg.right+30*PERCEN, 30*PERCEN, 400*PERCEN, 30*PERCEN)];
       self.name.backgroundColor = [UIColor clearColor];
       self.name.textAlignment = NSTextAlignmentLeft;
        self.name.textColor = UIColorFromHex(0xffffff);
        self.name.font = [UIFont systemFontOfSize:30*PERCEN];
        self.name.text = _dateDic[@"NickName"];
     //   self.name.text = @"Emily的妈妈";
        [headerView addSubview:self.name];
        //粉丝
       _numberOfFan=[[UILabel alloc] initWithFrame:CGRectMake(_headerImg.right+30*PERCEN,  self.name.bottom+30*PERCEN, 400*PERCEN, 26*PERCEN)];
        _numberOfFan.backgroundColor = [UIColor clearColor];
        _numberOfFan.textAlignment = NSTextAlignmentLeft;
        _numberOfFan.textColor = UIColorFromHex(0xffffff);
        _numberOfFan.font = [UIFont systemFontOfSize:26*PERCEN];
        _numberOfFan.text = [NSString stringWithFormat:@"%@粉丝",FansNum];
        
        [headerView addSubview:_numberOfFan];
        //时钟图标
        UIImage *timeImg = [UIImage imageNamed:@"shijian_qzxbf"];
        UIImageView *timeImgView = [[UIImageView alloc]initWithFrame:CGRectMake(_headerImg.right+30*PERCEN , _numberOfFan.bottom+20*PERCEN, timeImg.size.width, timeImg.size.height)];
        timeImgView.backgroundColor = [UIColor clearColor];
        timeImgView.layer.cornerRadius = timeImgView.height / 2.;
        timeImgView.layer.masksToBounds = YES;
        timeImgView.image = timeImg;
        [headerView addSubview:timeImgView];

        _timeOnshow=[[UILabel alloc]initWithFrame:CGRectMake(timeImgView.right+10*PERCEN, _numberOfFan.bottom+20*PERCEN, 200*PERCEN, 24*PERCEN)];
        _timeOnshow.backgroundColor = [UIColor clearColor];
        _timeOnshow.textAlignment = NSTextAlignmentLeft;
        _timeOnshow.textColor = UIColorFromHex(0xffffff);
        _timeOnshow.font = [UIFont systemFontOfSize:24*PERCEN];

        NSDate *aDate = [NSDate dateWithTimeIntervalSinceReferenceDate:[_dateDic[@"CreateTime"] doubleValue]];
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
        [dateFormatter setDateFormat:@"HH:mm"];
        NSString *datStr = [dateFormatter stringFromDate:aDate];
        _timeOnshow.text = datStr;
        [headerView addSubview:_timeOnshow];
        //关注按钮
        UIImage *focusImg = [UIImage imageNamed:@"yiguanzhu_fs"];
        
        focusBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        focusBtn.frame = CGRectMake(headerView.width-focusImg.size.width-30*PERCEN, 30*PERCEN, focusImg.size.width, focusImg.size.height);
        if (isFocus) {
              [focusBtn setImage:focusImg forState:UIControlStateNormal];
        }else{
            [focusBtn setImage:[UIImage imageNamed:@"jiaguanzhu_fs"]forState:UIControlStateNormal];
        }
 //
//        [focusBtn setImage:focusImg forState:UIControlStateSelected];
        focusBtn.backgroundColor = [UIColor clearColor];
        [focusBtn addTarget:self action:@selector(focusClick:) forControlEvents:UIControlEventTouchUpInside];
        [headerView addSubview:focusBtn];
 //试听人数
        _numberOfListen=[[UILabel alloc] initWithFrame:CGRectMake(headerView.width-30*PERCEN-100, _timeOnshow.top, 100, timeImg.size.height)];
        _numberOfListen.backgroundColor = [UIColor clearColor];
        _numberOfListen.textAlignment = NSTextAlignmentLeft;
        _numberOfListen.textColor  = UIColorFromHex(0xffffff);
        _numberOfListen.font = [UIFont systemFontOfSize:24*PERCEN];
        _numberOfListen.text = [NSString stringWithFormat:@"试听%@次",_dateDic[@"AuditionNum"]];
                                [headerView addSubview:_numberOfListen];
//试听图标
        UIImage *listenImg = [UIImage imageNamed:@"shiting_qzxbf"];
        UIImageView *listenImgView = [[UIImageView alloc] initWithFrame:CGRectMake(_numberOfListen.left-10*PERCEN-listenImg.size.width, _numberOfListen.top, listenImg.size.width, listenImg.size.height)];
        listenImgView.backgroundColor = [UIColor clearColor];
        listenImgView.layer.cornerRadius = timeImgView.height / 2.;
        listenImgView.layer.masksToBounds = YES;
        listenImgView.image = listenImg;
        [headerView addSubview:listenImgView];
        return headerView;
        
    }
    return nil;
    
}
#pragma mark--关注
- (void)focusClick:(UIButton *)btn {
    
    if (![UserManager standerDefult].userModel.UserID) {
        MBLoginController *registerLastVC = [[MBLoginController alloc] init];
        registerLastVC.formBaseViewCtrl = NSStringFromClass([self class]);
        [self.navigationController pushViewController:registerLastVC animated:YES];
        return;
    }
    
    if (![_dateDic isKindOfClass:[NSDictionary class]]) return;
    UserModel *model = [UserManager standerDefult].userModel;
    if (!model) return;

    NSNumber * UserID= [UserManager standerDefult].userModel.UserID;
    NSNumber * IssueUserID= _dateDic[@"UserID"];
    //取消关注
    if (isFocus) {
    
        [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:FAMILYSHOW_MYATTENTION_CANCEL_URL_PATH,IssueUserID,UserID] view:nil success:^(id json) {
             if ([json[@"ret_code"] integerValue]==0) {
                 isFocus=NO;
            [btn setImage:[UIImage imageNamed:@"jiaguanzhu_fs"] forState:0];
             }else{
                 [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
             }
        } failure:^(NSError *error) {
             [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    }else{
     
        [[HTTPManager standerDefault]AFGetRequest:[NSString stringWithFormat:FAMILYSHOW_MYATTENTION_ADD_URL_PATH,IssueUserID,UserID] view:nil success:^(id json) {
            if ([json[@"ret_code"] integerValue]==0) {
                [btn setImage:[UIImage imageNamed:@"yiguanzhu_fs"] forState:0];
                isFocus=YES;
            }else{
                [ErrorMessage showErrorMessage:json[@"message"] inView:self.view];
            }
        } failure:^(NSError *error) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    }
}
#pragma mark--进入详细评论区
- (void)onSelectForNewCellAction
{
    MBSpaceNewsDetailViewController*vc=[[MBSpaceNewsDetailViewController alloc]init];
    vc.dataArr = _commentDateArr;
    vc.isFormMyNews = NO;
    vc.taUserID = [NSString stringWithFormat:@"%@",[_dateDic objectForKey:@"UserID"]];
    

    [self.navigationController pushViewController:vc animated:YES];
    
}

-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section{
    if (self.type==IdentityType_son) {
         return 190*PERCEN;
    }
    return 0;
}
//选中后的响应函数
- (void)playTable:(NSUInteger)tableNumber {
    musicArrayNumber = tableNumber;
    [self updatePlayerSetting];
}

//- (void)clickButtonAction{
//    [shareView setShareVC:self content:@"分享" image:[UIImage imageNamed:@"test"] url:@"https://github.com/ClaudeLi/CLShare.git"];
//    [shareView show];
//}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
